<?php
declare (strict_types = 1);

namespace app\command;

use think\cache\driver\Redis;
use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;
use think\facade\Config;
use think\facade\Db;
use app\common\tools\PhpSort;

class Sort extends Command
{
    protected function configure()
    {
        // 指令配置
        $this->setName('app\command\sort')
            ->setDescription('排序');    
    }

    protected function execute(Input $input, Output $output)
    {
    	$this->handle();
    }

    public function handle()
    {   
        // $data = [234,2,3454,56,1,78,23,346,232,3453,3432,5,2,78,43,2,6,78];
        $data = [234,2,3454,56,1,78,23,346,232,3453,3432,5,21,708,43,24,6,718];
        //$res = PhpSort::quickSort($data, 0 , count($data)-1);
        // $res = PhpSort::quickSort($data);

        // $res = PhpSort::quickSortOne($data);
        $start = PhpSort::timedate();
        $res = PhpSort::bubbleSort($data);
        $end = PhpSort::timedate();
        echo ($end-$start)." 选择排序 之分而治之\n";
        var_dump($res);
    }

}
